/**

 * @class ConceptForm
 * @extends Ext.form.FormPanel
 * @description  分类词form
 */
ConceptForm = Ext.extend(Ext.form.FormPanel, {

    // 构造方法
    constructor : function(_config) {
        if (_config == null) {
            _config = {};
        }
        Ext.apply(this, _config);

        // 调用父类的构造方法
        ConceptForm.superclass.constructor.call(this, {
            layout : "form", // from布局
            labelWidth : 110, // 宽度
            baseCls : "x-plain", // 统一背景色
            bodyStyle : "padding:8px;", // 样式

            defaults : {
                anchor : "95%" ,// 锚点布局
                xtype : "textfield"
            },
            items : [

                /* { fieldLabel: "ID",name: 'id'},*/
                {fieldLabel: "主题UI号",name: 'dui',maxLength:'20'},
                {fieldLabel: "主题词",name: 'dname' ,maxLength:'200'},
                {fieldLabel: "概念词是否作为优选主题词",xtype:'radiogroup',
                    items:[
                        {
                            fieldLabel: '',
                            labelSeparator: '',
                            boxLabel: '是',
                            name: 'preferredyn',
                            inputValue: 'Y'
                        },
                        {

                            fieldLabel: '',
                            boxLabel: '否',
                            name: 'preferredyn',
                            inputValue: 'N'
                        }

                    ] },
                {fieldLabel: "概念UI号",name: 'cui',maxLength:'20'},
                {fieldLabel: "概念名称",name: 'cname',maxLength:'200'}  ,
                {fieldLabel: "概念在UML中的UI号",name: 'cumlsui',maxLength:'20'}  ,
                {fieldLabel: "化学物质结构名称",name: 'cumlsui',xtype:'textarea',maxLength:'800'} ,
                {fieldLabel: "化学物质登记号",name: 'registrynumber',xtype:'textarea',maxLength:'400'}   ,
                {fieldLabel: "范畴注释",name: 'scopenote',xtype:'textarea',maxLength:'1200'} ,
                { fieldLabel: "概念词与主题词的关系",name: 'crelationname',maxLength:'300'} ,
                {fieldLabel: "优选概念词的UI号",name: 'crelation1ui',maxLength:'600'},
                {fieldLabel: "其他概念词的UI号",name: 'crelation2ui',maxLength:'600'}  ,
                {fieldLabel: "相关化学物质登记号",name: 'relatedregistrynumber',maxLength:'800'}   ,
                {fieldLabel: "语义关系代码", name: 'semantictypeuis',maxLength:'200'}  ,
                {fieldLabel: "语义关系描述", name: 'semantictypenames' ,maxLength:'400'}

            ]
        })
    },

    /**
     *
     * @param _url
     */
    mySubmit : function(_url) {

        this.getForm().submit({
            url : _url,
            waitTitle : "数据传输",
            waitMsg : "数据传输中,请稍等...",
            // 成功回调方法
            success : this.onSuccess,
            // 失败回调方法
            failure : this.onFailure,
            // 作用域
            scope : this

        })
    },

    /**
     * 请求成功的回调方法
     *
     * @param {}
            *            _form
     * @param {}
            *            _action
     */
    onSuccess : function(_form, _action) {
        //alert(_action.result.success);
        if (_action.result.success == true) {
            // 调用当前组建的父容器的onCloseWinClick()事件
            this.ownerCt.onCloseWinClick();
            /**
             * _urgp 是 hrmfactory.userrole.userRole.jsp
             * 中UserRoleGridPanel类的实例
             */
            Ext.Msg.alert("系统消息", _action.result["errorMsg"]);
            _urgp.getStore().reload();
        }
    },

    /**
     * 请求失败的回调方法
     *
     * @param {}
            *            _form
     * @param {}
            *            _action
     */
    onFailure : function(_form, _action) {
        Ext.Msg.alert("系统消息", _action.result["errorMsg"]);
    },

    /**
     * 获取form的值
     *
     * @return {}
     */
    getFormValues : function() {
        return new Ext.data.Record(this.getForm().getValues());
    },

    /**
     * 给表单设置值
     *
     * @param {}
            *            _record
     */
    setFormValues : function(_record) {
        this.getForm().loadRecord(_record);
    },

    /**
     * 重置表单
     */
    reset : function() {
        this.getForm().reset();
    }
});